package cn.micai.base.io;

import java.io.*;

/**
 * 描述：
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/6/20 18:07
 */
public class StringToInputStreamExample {

    public static void main(String [] args) {

        String str = "This is the content";

        try {
            // convert String into InputStream
            InputStream is = new ByteArrayInputStream(str.getBytes());

            // read it with BufferedReader
            BufferedReader br = new BufferedReader(new InputStreamReader(is));

            String line;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }

            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
